local skynet = require 'skynet'
require 'skynet.manager'

local nmath = require 'nggs.base.math'
local ntable = require "nggs.base.table"

skynet.error('test6 started')

local base_chapter = {
    {
        chapter = 1,
        name = '大丘丘',
        id = 101,
        battleid = 2,
        guanka = 1,
        reward = {
            {1001, 10},
            {1002, 10}
        },
        rewardarmy = {
            {101, 10}
        }
    },
    {
        chapter = 1,
        name = '大丘丘',
        id = 101,
        battleid = 3,
        guanka = 2,
        rewardarmy = {
            {101, 10}
        }
    },
    {
        chapter = 1,
        name = '大丘丘',
        id = 101,
        battleid = 4,
        guanka = 3,
        reward = {
            {1001, 10},
            {1002, 10}
        },
        rewardarmy = {
            {101, 10}
        }
    },
    {
        chapter = 2,
        name = '二丘丘',
        id = 201,
        battleid = 5,
        guanka = 1,
        rewardarmy = {
            {201, 10}
        }
    },
    {
        chapter = 2,
        name = '二丘丘',
        id = 201,
        battleid = 6,
        guanka = 2,
        reward = {
            {1001, 10},
            {1002, 10}
        },
        rewardarmy = {
            {201, 10}
        }
    },
    {
        chapter = 2,
        name = '二丘丘',
        id = 201,
        battleid = 7,
        guanka = 3,
        rewardarmy = {
            {201, 10}
        }
    }
}

skynet.start(
    function()
        skynet.timeout(
            300,
            function()
                skynet.error('test6 end')
                skynet.sleep(0)
                skynet.abort()
            end
        )

        Log.Printf("before shuffle: %s", Inspect(base_chapter))

        base_chapter = ntable.Shuffle(base_chapter)

        Log.Printf("after shuffle: %s", Inspect(base_chapter))

    end
)
